<?php

namespace App\Services\Register;

use App\Services\ProjectValidate;

/**
 * 当前模块验证规则集合
 *
 * Class ValidateUser
 */
class ValidateRegister extends ProjectValidate {
    /**
     * 类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        // TODO: Implement initValidate() method.
//        if (!empty($initData['status'])) {
//            $this->rules['status']  = 'int:0,1,2';
//        }
    }

    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'real_name'        => 'required|string|max:5|min:2',
        'team'             => 'required|string',
        'phone'            => 'required|regex:/^1[34578][0-9]{9}$/|unique:users,phone',
        'baidu'            => 'url',
        'stage_name'       => 'string',
        'provice'          => 'required|string',
        'major'            => 'required|int|in:1,2,3,4,5',
        'links'            => 'url',
        'phone_name'       => 'required|string|max:5|min:2',
        'phone_stage'      => 'string',
        'phone_major'      => 'required|int|in:1,2,3,4,5',
        'operate'          => 'required|int|in:1,2',
        'company_business' => 'required|int|in:1,2,3',
        'copyright_number' => 'required|int|in:1,2,3,4',
        'society_code'     => 'required',
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [
    ];

    /**
     * @var array 上面规则中定义的 key 的名字
     */
    public $attributes = [
        'real_name'        => '真实姓名',
        'phone'            => '手机号码',
        'baidu'            => '百度百科',
        'stage_name'       => '艺名',
        'provice'          => '省市',
        'major'            => '专业',
        'links'            => '链接',
        'phone_name'       => '联系人姓名',
        'phone_stage'      => '联系人艺名',
        'phone_major'      => '联系人职位',
        'operate'          => '主要经营',
        'team'             => '公司/团体名',
        'company_business' => '主要业务',
        'copyright_number' => '版权数量',
        'society_code'     => '社会编码',
    ];

}
